local lsp_jinmo = fk.CreateSkill {
    name = "lsp_jinmo",
    tags = { Skill.Compulsory },
}

Fk:loadTranslationTable {
    ["lsp_jinmo"] = "禁默",
    [":lsp_jinmo"] = "锁定技，其他角色无法使用或打出无色牌；每轮开始时，其他角色所有转化技和视为技失效(即所有描述中包含“视为使用、当做”的技能)。",
}
lsp_jinmo:addEffect(fk.RoundStart, {
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(lsp_jinmo.name)
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        for _, id in ipairs(room:getOtherPlayers(player)) do
            for _, skill_name in ipairs(id:getSkillNameList()) do
                local skills = {}
                local str = Fk:translate(":" .. skill_name)
                local s = Fk.skills[skill_name]
                if string.find(str, "当做") or string.find(str, "牌当") or string.find(str, "视为使用") then
                    table.insertIfNeed(skills, s.name)
                    if #skills > 0 then
                        room:setPlayerMark(id, "lsp_jinmo", skills)
                    end
                end
            end
        end
    end,
})
lsp_jinmo:addEffect("prohibit", {
    prohibit_use = function(self, player, card)
        if table.find(Fk:currentRoom().alive_players, function(p) --筛选是否持有技能
                return p:hasSkill(lsp_jinmo.name) and p ~= player
            end) then
            return not card:matchVSPattern(".|.|^nosuit")
        end
    end,
    prohibit_response = function(self, player, card)
        if table.find(Fk:currentRoom().alive_players, function(p)
                return p:hasSkill(lsp_jinmo.name) and p ~= player
            end) then
            return not card:matchVSPattern(".|.|^nosuit")
        end
    end
})

lsp_jinmo:addEffect("invalidity", {
    invalidity_func = function(self, from, skill)
        return from:getMark("lsp_jinmo") ~= 0 and skill:isPlayerSkill(from) and
            table.contains(from:getMark("lsp_jinmo"), skill.name)
    end,
})

lsp_jinmo:addLoseEffect(function(self, player, is_death)
    for _, id in ipairs(player.room.alive_players) do
        if player:getMark("lsp_jinmo") > 0 then
            player.room:setPlayerMark(id, "lsp_jinmo", 0)
        end
    end
end)
return lsp_jinmo
